package com.woniu.zsd.permission.mapper;

import com.woniu.zsd.permission.entity.Resource;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.PropertyValues;

import java.util.List;

public interface ResourceMapper extends BaseMapper<Resource> {
    List<String> findResourceNamesByAdminId(Integer adminId);

    @Insert("insert into resource(name,resource_desc) values(#{name},#{resourceDesc})")
    void addResource(@Param("name") String name,@Param("resourceDesc") String resourceDesc);

    @Update("update resource set name=#{name},resource_desc=#{resourceDesc} where resource_id=#{resourceId}")
    void updateResource(@Param("resourceId") Integer resourceId,@Param("name") String name,@Param("resourceDesc") String resourceDesc);

    @Delete("delete from resource where resource.resource_id=#{resourceId}")
    void deleteResource(Integer resourceId);

}